package com.xm.servlet.background.commodity;


import com.google.gson.Gson;
import com.xm.service.background.CommodityInsuranceTypeService;
import lombok.SneakyThrows;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 获取商品保险类别
 * @author 康文程
 * @date 2024-1-18 上午 10:26
 */
@WebServlet("/background/get/all/commodity/insurance/type")
public class GetAllCommodityInsuranceTypeServlet extends HttpServlet {
    private final CommodityInsuranceTypeService dao = new CommodityInsuranceTypeService();
    @SneakyThrows
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
        resp.setContentType("text/html;charset=UTF-8");
        resp.getWriter().print(new Gson().toJson(dao.getAllCommodityInsuranceTypes()));
    }
}
